package com.ruoyi.delivery.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.domain.GarbageRecyclingDetailOrder;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.delivery.service.IGarbageRecyclingDetailOrderService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 垃圾回收详情订单Controller
 * 
 * @author ruoyi
 * @date 2021-03-30
 */
@Api(tags = "垃圾回收详情订单")
@RestController
@RequestMapping("/detailedOrder")
public class GarbageRecyclingDetailOrderController extends BaseController
{
    @Autowired
    private IGarbageRecyclingDetailOrderService garbageRecyclingDetailOrderService;

    /**
     * 查询垃圾回收详情订单列表
     */
    @ApiOperation(value = "查询垃圾回收详情订单列表",notes = "按条件查询垃圾回收详情订单列表")
    @ApiImplicitParam(name = "garbageRecyclingDetailOrder", value = "查询垃圾回收详情订单列表", required = false, dataType = "GarbageRecyclingDetailOrder")
    @GetMapping("/list")
    public TableDataInfo list(GarbageRecyclingDetailOrder garbageRecyclingDetailOrder)
    {
        startPage();
        List<GarbageRecyclingDetailOrder> list = garbageRecyclingDetailOrderService.selectGarbageRecyclingDetailOrderList(garbageRecyclingDetailOrder);
        return getDataTable(list);
    }

    /**
     * 获取垃圾回收详情订单详细信息
     */
    @ApiOperation(value = "获取垃圾回收详情订单详细信息",notes = "根据编号获取垃圾回收详情订单详细信息")
    @ApiImplicitParam(name = "detailorderid", value = "垃圾回收订单详细表", required = true, dataType = "Long")
    @GetMapping(value = "/{detailorderid}")
    public AjaxResult getInfo(@PathVariable("detailorderid") Long detailorderid)
    {
        return AjaxResult.success(garbageRecyclingDetailOrderService.selectGarbageRecyclingDetailOrderById(detailorderid));
    }

    /**
     * 新增垃圾回收详情订单
     */
    @ApiOperation(value = "新增垃圾回收详情订单",notes = "新增垃圾回收详情订单并实现相关业务")
    @ApiImplicitParam(name = "garbageRecyclingDetailOrder", value = "垃圾回收订单详细表", required = true, dataType = "GarbageRecyclingDetailOrder")
    @Log(title = "垃圾回收详情订单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(GarbageRecyclingDetailOrder garbageRecyclingDetailOrder)
    {
        return toAjax(garbageRecyclingDetailOrderService.insertGarbageRecyclingDetailOrder(garbageRecyclingDetailOrder));
    }

    /**
     * 修改垃圾回收详情订单
     */
    @ApiOperation(value = "修改垃圾回收详情订单",notes = "修改垃圾回收详情订单并实现相关业务")
    @ApiImplicitParam(name = "garbageRecyclingDetailOrder", value = "垃圾回收订单详细表", required = true, dataType = "GarbageRecyclingDetailOrder")
    @Log(title = "垃圾回收详情订单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GarbageRecyclingDetailOrder garbageRecyclingDetailOrder)
    {
        return toAjax(garbageRecyclingDetailOrderService.updateGarbageRecyclingDetailOrder(garbageRecyclingDetailOrder));
    }

    /**
     * 删除垃圾回收详情订单
     */
    @ApiOperation(value = "删除垃圾回收详情订单",notes = "新增垃圾回收详情订单并实现相关业务")
    @ApiImplicitParam(name = "detailorderids", value = "垃圾回收订单详细表", required = true, dataType = "Long[]")
    @Log(title = "垃圾回收详情订单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{detailorderids}")
    public AjaxResult remove(@PathVariable Long[] detailorderids)
    {
        return toAjax(garbageRecyclingDetailOrderService.deleteGarbageRecyclingDetailOrderByIds(detailorderids));
    }
}
